﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManagerUser.aspx.cs" Inherits="Web.Admin.Admins.ManagerUser" %>

<<%@ Register Src="UserRolesControl.ascx" TagName="UserRolesControl" TagPrefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:LoginName ID="LoginName1" runat="server" />
    
    <div>
    <table class="Region1" cellpadding="0" cellspacing="0">
    <tr>
      <td class="Interior1" align="left" valign="top" cellpadding="0" cellspacing="0">
        <table class="Tabs1" cellpadding="0" cellspacing="0">
          <tr>
            <td>
              <asp:Menu ID="Region1Tabs" runat="server" Orientation="Horizontal" SkinID="Tabs1" OnMenuItemClick="Region1Tabs_MenuItemClick"><Items><asp:MenuItem Value="Users" Text="Users" Selected="True" />
                  <asp:MenuItem Value="Roles" Text="Roles" /></Items></asp:Menu>
            </td>
          </tr>
        </table>
        <asp:MultiView ID="Region1MultiView" runat="server" ActiveViewIndex="0">
          <asp:View ID="Region1Users" runat="server">
            <div class="GridView1" id="UserViewDiv" runat="server">
              <asp:ObjectDataSource ID="UserViewDataSource" runat="server" EnablePaging="True" OldValuesParameterFormatString="original_0" SelectMethod="FindUsersByName" TypeName="Web.Admin.Admins.MembershipFactory" SelectCountMethod="FindUsersByNameCount"><SelectParameters><asp:ControlParameter ControlID="UserQueryTextBox" Name="usernameToMatch" PropertyName="Text" Type="String" /></SelectParameters></asp:ObjectDataSource>
              <table class="ViewParameters">
                <tr>
                  <td class="Parameter">
                    <div class="Content">Name:</div>
                    <asp:TextBox ID="UserQueryTextBox" runat="server" />
                  </td>
                  <td class="Parameter">
                    <div class="Content">&nbsp;</div>
                    <asp:Button ID="UserViewGoButton" runat="server" Text="Go" OnClick="UserViewGoButton_Click" />
                  </td>
                </tr>
              </table>
              <asp:GridView ID="UserView" runat="server" AutoGenerateColumns="False" DataSourceID="UserViewDataSource" AllowPaging="True" DataKeyNames="UserName" OnPageIndexChanged="UserView_PageIndexChanged"><Columns><asp:CommandField ShowSelectButton="True" />
                  <asp:BoundField DataField="UserName" HeaderText="Name" ReadOnly="True" SortExpression="UserName" />
                  <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                  <asp:BoundField DataField="Comment" HeaderText="Comment" SortExpression="Comment" />
                  <asp:CheckBoxField DataField="IsOnline" HeaderText="Online" ReadOnly="True" SortExpression="IsOnline"><ItemStyle HorizontalAlign="Center"></ItemStyle><HeaderStyle HorizontalAlign="Center"></HeaderStyle></asp:CheckBoxField>
                  <asp:BoundField DataField="LastLoginDate" HeaderText="Last Login" SortExpression="LastLoginDate" />
                  <asp:BoundField DataField="LastActivityDate" HeaderText="Last Activity" SortExpression="LastActivityDate" />
                  <asp:CheckBoxField DataField="IsApproved" HeaderText="Approved" SortExpression="IsApproved"><ItemStyle HorizontalAlign="Center"></ItemStyle><HeaderStyle HorizontalAlign="Center"></HeaderStyle></asp:CheckBoxField>
                  <asp:CheckBoxField DataField="IsLockedOut" HeaderText="Locked" ReadOnly="True" SortExpression="Locked Out"><ItemStyle HorizontalAlign="Center"></ItemStyle><HeaderStyle HorizontalAlign="Center"></HeaderStyle></asp:CheckBoxField>
                  <asp:BoundField DataField="CreationDate" HeaderText="Created On" ReadOnly="True" SortExpression="CreationDate" /></Columns></asp:GridView>
            </div>
            <div class="FormView1">
              <asp:ObjectDataSource ID="UserEditViewDataSource" runat="server" SelectMethod="FindUsersByName" TypeName="Web.Admin.Admins.MembershipFactory" OnSelecting="UserEditViewDataSource_Selecting" UpdateMethod="UpdateUser" OnUpdating="UserEditViewDataSource_Updating" DeleteMethod="DeleteUser" InsertMethod="Insert" OnDeleting="UserEditViewDataSource_Deleting" OnInserting="UserEditViewDataSource_Inserting"><SelectParameters><asp:ControlParameter ControlID="UserView" Name="usernameToMatch" PropertyName="SelectedValue" Type="String" /></SelectParameters></asp:ObjectDataSource>
              <asp:Label runat="server" ID="UserEditViewMessageBar"></asp:Label>
              <asp:DetailsView ID="UserEditView" runat="server" DataSourceID="UserEditViewDataSource" DataKeyNames="UserName" AllowPaging="True" AutoGenerateRows="False" OnItemCreated="UserEditView_ItemCreated" OnItemInserted="UserEditView_ItemInserted" OnItemCommand="UserEditView_ItemCommand" OnItemUpdated="UserEditView_ItemUpdated"><Fields><asp:TemplateField ShowHeader="False"><EditItemTemplate><asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Update" Text="Save" />&nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /></EditItemTemplate><InsertItemTemplate><asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Insert" Text="Save" />&nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /></InsertItemTemplate><ItemTemplate><asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Close" Text="Close" />&nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />&nbsp;<asp:Button ID="Button3" runat="server" CausesValidation="False" CommandName="New" Text="New" />&nbsp;<asp:Button ID="Button4" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /></ItemTemplate><ItemStyle CssClass="Top" HorizontalAlign="Right"></ItemStyle></asp:TemplateField>
                  <asp:TemplateField HeaderText="User Name" ItemStyle-CssClass="Field"><HeaderTemplate>User Name<div class="Description">Logon name of the membership user.</div></HeaderTemplate><ItemTemplate><asp:Label ID="UserName" runat="server" Font-Bold="true" Text='<%# Eval("UserName") %>'>
                      </asp:Label></ItemTemplate><InsertItemTemplate><div class="Description">Enter user name:</div>
                      <asp:TextBox ID="UserName" runat="server" Text='<%# Bind("UserName") %>'>
                      </asp:TextBox>
                      <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" SetFocusOnError="true" Display="dynamic" ControlToValidate="UserName" Text="*" />
                      <div class="Description">Password:</div>
                      <asp:TextBox ID="Password" runat="server" TextMode="Password" Text='<%# Bind("Password") %>'>
                      </asp:TextBox>
                      <div class="Description">Password Confirmation:</div>
                      <asp:TextBox ID="PasswordConfirmation" runat="server" TextMode="Password" />
                      <asp:CompareValidator ID="ComparePasswords" runat="server" ControlToValidate="PasswordConfirmation" ControlToCompare="Password" Display="Dynamic" SetFocusOnError="true" Text="Password and confirmation do not match." /></InsertItemTemplate></asp:TemplateField>
                  <asp:TemplateField HeaderText="Roles" ItemStyle-CssClass="Field"><HeaderTemplate>Roles<div class="Description">Roles are used for authorization checking in this application.</div></HeaderTemplate><ItemTemplate><uc:UserRolesControl ID="UserRolesControl1" runat="server" ReadOnly="true" UserName='<%# Eval("UserName") %>'>
                      </uc:UserRolesControl></ItemTemplate><EditItemTemplate><uc:UserRolesControl ID="UserRolesControl1" runat="server" UserName='<%# Eval("UserName") %>'>
                      </uc:UserRolesControl></EditItemTemplate><InsertItemTemplate><uc:UserRolesControl ID="UserRolesControl1" runat="server" UserName='<%# Eval("UserName") %>'>
                      </uc:UserRolesControl></InsertItemTemplate></asp:TemplateField>
                  <asp:BoundField DataField="Email" HeaderText="E-mail" SortExpression="Email" ItemStyle-CssClass="Field"><ControlStyle Width="300px"></ControlStyle></asp:BoundField>
                  <asp:TemplateField HeaderText="Comment" ItemStyle-CssClass="Field"><HeaderTemplate>Comment<div class="Description">Application-specific information for the membership user.</div></HeaderTemplate><ItemTemplate><asp:Label ID="Comment" runat="server" Text='<%# Eval("Comment") %>'>
                      </asp:Label></ItemTemplate><EditItemTemplate><asp:TextBox ID="Comment" runat="server" Columns="80" Text='<%# Bind("Comment") %>'>
                      </asp:TextBox></EditItemTemplate></asp:TemplateField>
                  <asp:CheckBoxField DataField="IsOnline" HeaderText="Online" ReadOnly="True" SortExpression="IsOnline" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:TemplateField HeaderText="Password Question" SortExpression="PasswordQuestion" ItemStyle-CssClass="Field"><ItemTemplate><asp:Label ID="PasswordQuestion" runat="server" Text='<%# Eval("PasswordQuestion") %>'>
                      </asp:Label></ItemTemplate><InsertItemTemplate><div class="Description">
														Question:
													</div>
                      <asp:TextBox ID="PasswordQuestion" runat="server" Columns="50" Text='<%# Bind("PasswordQuestion") %>'>
                      </asp:TextBox>
                      <div class="Description">Answer:</div>
                      <asp:TextBox ID="TextBox1" runat="server" Columns="50" Text='<%# Bind("PasswordAnswer") %>'>
                      </asp:TextBox></InsertItemTemplate><HeaderTemplate>Password Question<div class="Description">The password question for the membership user. Question is matched with the password answer, which allows user to recall the password via automatically generated email.</div></HeaderTemplate></asp:TemplateField>
                  <asp:BoundField DataField="LastPasswordChangedDate" HeaderText="Last Password Changed" ReadOnly="True" SortExpression="LastPasswordChangedDate" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:BoundField DataField="CreationDate" HeaderText="Created On" ReadOnly="True" SortExpression="CreationDate" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:CheckBoxField DataField="IsApproved" HeaderText="Approved&lt;div class=&quot;Description&quot;&gt;Indicates whether the membership user can be authenticated.&lt;/div&gt;" SortExpression="IsApproved" ItemStyle-CssClass="Field" />
                  <asp:BoundField DataField="LastActivityDate" HeaderText="Last Activity" SortExpression="LastActivityDate" ReadOnly="True" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:BoundField DataField="LastLoginDate" HeaderText="Last Login" SortExpression="LastLoginDate" ReadOnly="True" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:CheckBoxField DataField="IsLockedOut" HeaderText="Locked Out" ReadOnly="True" SortExpression="IsLockedOut" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:BoundField DataField="LastLockoutDate" HeaderText="Last Lockout" ReadOnly="True" SortExpression="LastLockoutDate" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:BoundField DataField="ProviderName" HeaderText="Provider Name" ReadOnly="True" SortExpression="ProviderName" InsertVisible="False" ItemStyle-CssClass="Field" />
                  <asp:TemplateField ShowHeader="False"><EditItemTemplate><asp:Button ID="Button3" runat="server" CausesValidation="True" CommandName="Update" Text="Save" />&nbsp;<asp:Button ID="Button4" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /></EditItemTemplate><InsertItemTemplate><asp:Button ID="Button3" runat="server" CausesValidation="True" CommandName="Insert" Text="Save" />&nbsp;<asp:Button ID="Button4" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /></InsertItemTemplate><ItemTemplate><asp:Button ID="Button5" runat="server" CausesValidation="False" CommandName="Close" Text="Close" />&nbsp;<asp:Button ID="Button6" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />&nbsp;<asp:Button ID="Button7" runat="server" CausesValidation="False" CommandName="New" Text="New" />&nbsp;<asp:Button ID="Button8" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /></ItemTemplate><ItemStyle CssClass="Bottom" HorizontalAlign="Right"></ItemStyle></asp:TemplateField></Fields><EmptyDataTemplate>Click <asp:LinkButton ID="NewLink" runat="server" CommandName="New">here</asp:LinkButton> create a new user.</EmptyDataTemplate><RowStyle CssClass="Row"></RowStyle></asp:DetailsView>
            </div>
          </asp:View>
          <asp:View ID="Region1Roles" runat="server">
            <div class="GridView1">
              <asp:Label ID="RolesMessageBar" runat="server"></asp:Label>
              <div class="Description">
										These are the roles that can be used for authorization purposes.
									</div>
              <uc:UserRolesControl ID="UserRolesControl2" runat="server" />
              <div class="Description" style="margin-top: 16px;">
										Enter the name of new role and press <i>Add</i> button to add role to the list.
									</div>
              <div class="Content">
										Role Name:
									</div>
              <asp:TextBox ID="RoleTextBox" runat="server" Columns="20" />
              <asp:RequiredFieldValidator ID="RoleTextBoxValidator" runat="server" ControlToValidate="RoleTextBox" SetFocusOnError="true" Display="Dynamic" />
              <asp:Button ID="AddRoleButton" runat="server" Text="Add" OnClick="AddRoleButton_Click" />
              <div class="Description" style="margin-top: 16px;">
										Select roles that you want to remove and press <i>Delete</i> button below.
									</div>
              <asp:Button ID="DeleteRolesButton" runat="server" Text="Delete" OnClientClick="if(!confirm('Delete selected roles?'))return false;" CausesValidation="False" OnClick="DeleteRolesButton_Click" />
            </div>
          </asp:View>
        </asp:MultiView>
      </td>
    </tr>
  </table>
    </div>
    </form>
</body>
</html>
